import { http } from "@/utils/http";

export interface InsertSightPoi {
  name: string;
  businessType: number;
  province: string;
  city: string;
  district: string;
  town: string;
  address: string;
  poiType: number;
  typeList: number[];
  lat: string;
  lon: string;
  rating: number;
  openTime: string;
  isShow: number;
}

export interface UpdateSightPoi {
  id: number;
  name: string;
  businessType: number;
  province: string;
  city: string;
  district: string;
  town: string;
  address: string;
  poiType: number;
  typeList: number[];
  lat: string;
  lon: string;
  rating: number;
  openTime: string;
  isShow: number;
}

export interface RemoveSightPoiById {
  id: number;
}

export interface EnableSightPoiById {
  id: number;
  isShow: number;
}

export interface QuerySightPoiById {
  id: number;
}

export interface SightPoiDetailVO {
  id: number;
  name: string;
  businessType: number;
  province: string;
  city: string;
  district: string;
  town: string;
  address: string;
  poiType: number;
  typeList: number[];
  lat: string;
  lon: string;
  rating: number;
  openTime: string;
  isShow: number;
}

export interface QuerySightPoiByCondition extends BizPageReq {
  id: number;
  name: string;
  businessType: number;
  province: string;
  city: string;
  poiType: number;
}

//新增Poi信息
export const insertCityInfoApi = (data: InsertSightPoi) => {
  return http.request<BizResponse<Boolean>>("post", "/poi/insertSightPoi", {
    data
  });
};

//更新Poi信息
export const updateSightPoiByIdApi = (data: UpdateSightPoi) => {
  return http.request<BizResponse<Boolean>>("post", "/poi/updateSightPoiById", {
    data
  });
};

//根据主键删除景点Poi信息
export const removeSightPoiByIdApi = (data: RemoveSightPoiById) => {
  return http.request<BizResponse<Boolean>>("post", "/poi/removeSightPoiById", {
    data
  });
};

//启禁用Poi信息
export const enableSightPoiByIdApi = (data: EnableSightPoiById) => {
  return http.request<BizResponse<Boolean>>("post", "/poi/enableSightPoiById", {
    data
  });
};

//根据主键查询Poi信息详情
export const querySightPoiByIdApi = (data: QuerySightPoiById) => {
  return http.request<BizResponse<SightPoiDetailVO>>(
    "post",
    "/poi/querySightPoiById",
    {
      data
    }
  );
};

//多条件查询Poi信息
export const querySightPoiByConditionApi = (data: QuerySightPoiByCondition) => {
  return http.request<BizPageResponse<BizPageResult<SightPoiDetailVO>>>(
    "post",
    "/poi/querySightPoiByCondition",
    {
      data
    }
  );
};
